package modelLayer;

import java.util.ArrayList;
/**
 * ForestContainer class that manages the ArrayList with forest objects
 * @author Thomas Bonderup
 * @version 1.0.0
 */
public class ForestContainer {

	//instance variables
	private static ForestContainer instance;
	private ArrayList<Forest> forestList;
	
	/**
	 * Constructor for the class ForestContainer
	 */
	public ForestContainer() {
		
		forestList = new ArrayList<Forest>();
	}
	/**
	 * Singleton
	 * @return instance
	 */
	public static ForestContainer getInstance() {
		if(instance == null) {
			instance = new ForestContainer();
		}
		return instance;
	}
	/**
	 * Returns the objects of the ArrayList
	 * @return forestList
	 */
	public ArrayList<Forest> forests() {
		return forestList;
	}
	/**
	 * Adds forest objects to the ArrayList
	 * @param forest
	 */
	public void addForest(Forest forest) {
		forestList.add(forest);
	}
	/**
	 * Returns Forest object
	 * @param index
	 * @return Forest object
	 */
	public Forest getForest(int index) {
		return forestList.get(index);
	}
	
	public void deleteForest(int index) {
		forestList.remove(index);
	}
}
